package com.ifcar.app.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class UserAction extends Base {
	
	private static final long serialVersionUID = -2268598877275370708L;

	/**
	 * account api 服务入口
	 */
	public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {
		
		HttpServletRequest req = (HttpServletRequest) request;
		HttpServletResponse resp = (HttpServletResponse) response;
		req.setCharacterEncoding("UTF-8");
		String content = "";
		String method = req.getParameter("method");
		if ("getinfo".equals(method)) {
			content = lookup(req,resp);
			sendContent(resp, content, CONTEXT_TYPE);
		}else if ("addfriend".equals(method)) {
			content = addfriend(req,resp);
			sendContent(resp, content, CONTEXT_TYPE);
		}else{
			
			_404Content(resp);
			
		}
		
		return;

	}	
	
	/**
	 * 查看用户
	 * @param request
	 * @param response
	 * @return
	 */
	private String lookup(ServletRequest request, ServletResponse response){
		return  "{}";
	}
	
	/**
	 * 新增用户
	 * @param request
	 * @param response
	 * @return
	 */
	private String addfriend(ServletRequest request, ServletResponse response){
		return  "{}";
	}
	
	/**
	 * 拉黑用户
	 * @param request
	 * @param response
	 * @return
	 */
	private String reject(ServletRequest request, ServletResponse response){
		return  "{}";
	}
	
}
